package br.com.fafica.sisape.repositorioarray;

import java.util.ArrayList;

import br.com.fafica.sisape.model.Clinica;

public class RepositorioClinica {
	
	static ArrayList <Clinica> clinicas = new ArrayList<Clinica>();
	static Integer cod = 0;
	
	public void createClinica(Clinica clinica){
		cod ++;
		clinica.setCod(cod);
		clinicas.add(clinica);
	}
	public ArrayList readClinica(){
		
		return clinicas;
	}
	public void updateClinica(Clinica clinica){
		
		for(int i = 0; i < clinicas.size(); i++){
			if(clinicas.get(i).getCod() == clinica.getCod()){
				clinicas.set(i, clinica);
			}
		}
	}
	public void deleteClinica(Clinica clinica){
		
		for(int i = 0; i < clinicas.size(); i++){
			if(clinicas.get(i).getCod() == clinica.getCod()){
				clinicas.remove(i);
			}
		}
		
	}

}